﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Microsoft.Extensions.Logging
{

    public static class ILoggerExtensions
    {

        internal static string MakeMessage(object sender, string msg, object tag)
        {
            return $"{sender.GetType().FullName}: {msg}" + Environment.NewLine + tag?.ToString();
        }

        public static void LogInformation(this ILogger logger, object sender, string msg, object tag)
        {
            logger.LogInformation(MakeMessage(sender, msg, tag));
        }

        public static void LogError(this ILogger logger, object sender, string msg, Exception ex, object tag)
        {
            logger.LogError(MakeMessage(sender, msg, tag));
        }

        public static void LogDebug(this ILogger logger, object sender, string msg, object tag)
        {
            logger.LogDebug(MakeMessage(sender, msg, tag));
        }

    }

}